package com.mrjy.common.qtz;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import com.mrjy.common.entity.VideoInfo;
import com.mrjy.custom.dao.ICustomModuleDao;
import com.mrjy.custom.dto.CustomModuleDto;
import com.mrjy.video.dao.IVideoDao;
import com.mrjy.video.dao.IVideoInfoDao;

public class VideoFreeFlagJob {
	@Resource
	private IVideoInfoDao videoInfoDao;
	@Resource
	private ICustomModuleDao customDao;
	
    private static Logger logger = Logger.getLogger(VideoFreeFlagJob.class);
    /**
     * @Description: 任务执行获取 token
     * @param    
     */
    @SuppressWarnings("unchecked")
	public void doJob() {
    	
    	CustomModuleDto customModule = new CustomModuleDto();
    	VideoInfo videoInfo = new VideoInfo();
    	customModule.setCmType(2);
    	List<CustomModuleDto> list = customDao.queryPageCustomModuleForFreeVideo(customModule);
    	if(list!= null && list.size()>0){
    		for (int i = 0; i < list.size(); i++) {
    			videoInfo.setId(list.get(i).getCmProgramId());
    			videoInfo.setFreeFlag(0);
    			int count = videoInfoDao.updateVideoFreeFlag(videoInfo);
    			logger.debug("修改微课的付费状态 ：=================================>");
			}
    	}
    	
    }
}
